<!--上传一本旧书-->
<ion-view ng-controller="ion_person_uploadOneUsedBook" view-title="{{title}}">
    <ion-nav-buttons side="right">
        <button class="button button-clear button-balanced" ui-sref="person.my">我</button>
    </ion-nav-buttons>
    <ion-content style="text-align: center" class="padding">
        <!-- 正在加载-->
        <div style="text-align: center;padding-top: 10px" ng-if="isLoading">
            <ion-spinner icon="ripple" class="spinner-balanced"></ion-spinner>
        </div>
        <!-- 扫码-->
        <div ng-if="!usedBookJson.isbn13">
            <h5>扫码书后面的条形码获得图书信息</h5>
            <button class="button button-outline button-balanced" ng-click="scanQRBtnOnClick()">扫条形码</button>
            <br>
            <button class="button button-clear button-small button-balanced" ng-click="noBarCodeModalView.show()">没条码?
            </button>
        </div>
        <!-- 图书基本信息-->
        <div class="list" ng-if="usedBookJson.isbn13">
            <!-- 封面-->
            <ion-item style="text-align: center">
                <img ng-src="{{bookInfo.attributes.bigImage}}" style="height: 180px"
                     ng-click="WeChatJS$.previewOneImage(bookInfo.attributes.bigImage)">
            </ion-item>
            <!-- 图书基本信息-->
            <ion-one-book-info ng-if="bookInfo" book-info="bookInfo"
                               should-show-used-books-count="true"></ion-one-book-info>
        </div>
        <!-- 填写价格和描述-->
        <div class="list list-inset">
            <label class="item item-input" ng-if="usedBookJson.role!='circle'">
                <input type="number" ng-model="usedBookJson.price" placeholder="输入要价(数字,人民币元)">
            </label>
            <label class="item item-input">
                <textarea rows="5" ng-model="usedBookJson.des" placeholder="对这本书你还有什么想说的吗?"></textarea>
            </label>
        </div>

        <button ng-disabled="!(!isLoading && usedBookJson.isbn13)"
                class="button button-block button-outline button-balanced"
                ng-click="submitOnClick()">提交
        </button>

        <ion-item>
            <small ng-if="usedBookJson.role==='sell'" style="font-size: x-small">上传要卖的旧书:把你不要的旧书低价卖给正需要它的同学</small>
            <small ng-if="usedBookJson.role==='need'" style="font-size: x-small">发布求书公告:把你正需要的书公告给社区帮你找到它</small>
            <small ng-if="usedBookJson.role==='circle'" style="font-size: x-small">分享书漂流:免费把你的书传递给下一位读者</small>
        </ion-item>

        <!-- 常用描述语-->
        <ion-list ng-if="InfoService$.commonUsedBookDesWords.length>0">
            <ion-item class="item-divider item-button-right">常用描述内容</ion-item>
            <ion-item style="white-space:normal;padding: 5px">
                <button class="button button-small button-outline button-balanced" style="margin: 5px"
                        ng-disabled="isLoading"
                        ng-repeat="word in InfoService$.commonUsedBookDesWords"
                        ng-click="usedBookJson.des=usedBookJson.des+' '+word"
                        ng-bind="word">
                </button>
            </ion-item>
        </ion-list>

    </ion-content>
    <script type="text/ng-template" id="template/helpModalView.html">
        <ion-modal-view>
            <ion-header-bar>
                <h2 class="title">书没条码时上传方法</h2>
                <button class="button button-clear button-balanced"
                        ng-click="noBarCodeModalView.hide()">返回
                </button>
            </ion-header-bar>
            <ion-content class="padding" style="text-align: center">
                <button class="button button-block button-outline button-balanced" ui-sref="book.search-list"
                        ng-click="noBarCodeModalView.hide()">
                    开始上传
                </button>
                <img style="max-width: 98%" ng-src="../img/uploadHelp.png">
            </ion-content>
        </ion-modal-view>

    </script>
</ion-view>